package com.example.bigwork.mapper;

import com.example.bigwork.entity.Product;
import com.example.bigwork.enums.ProductCategory;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Optional;

@Mapper
public interface ProductMapper {
    int insertProduct(Product product);
    Optional<Product> findById(@Param("id") Long id);
    List<Product> findByNameContaining(@Param("name") String name);
    List<Product> findByCategory(@Param("category") ProductCategory category);
    List<Product> findAll(); // For general listing, if needed
    int updateProductStock(@Param("id") Long id, @Param("newStockQuantity") int newStockQuantity);
    int updateProduct(Product product); // For general updates
}
